package com.health.system.model.organiza;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;

import com.health.system.javacommon.base.BaseEntity;
import com.health.system.model.system.User;
import com.health.system.model.system.UserRole;



/**
 * Title: 组织机构 数据类 
 * Description: DAO层映射到数据类,页面封装数据映射到数据类 
 * Copyright: Copyright (c) 2011-03 
 * Company: 
 * 
 * @author  
 * @version 1.0 
*/



public class DataOrganizations extends BaseEntity {
	
	//date formats
	public static final String FORMAT_BEGIN_TIME_ = DATE_TIME_FORMAT;
	public static final String FORMAT_CONTR_PERIOD_ = DATE_TIME_FORMAT;
	public static final String FORMAT_AUDIT_TIME_ = DATE_TIME_FORMAT;
	public static final String FORMAT_OPEN_TIME_ = DATE_TIME_FORMAT;
	
	//columns START
	/**cpid*/
	private java.lang.String id;
	/**higherId*/
	private java.lang.String higherId;
	/**代码*/
	private java.lang.String cpCode;
	/**全名*/
	private java.lang.String cpName;
	/**简称*/
	private java.lang.String abbreviation;
	/**公司介绍*/
	private java.lang.String aboutInfo;
	/**地区*/
	private java.lang.String areaId;
	
	private java.lang.String areaName;
	/**机构性质:1-SI管理系统,2-SI自服系统,3-EC自服务系统,9-其它*/
	private java.lang.String cpNature;
	/**合作伙伴类型:*/
	private java.lang.String coopType;
	/**合同开始时间*/
	private java.sql.Timestamp beginTime;
	private java.lang.String beginTimeString;
	/**电子合同号*/
	private java.lang.String contrNo;
	/**合同有效期*/
	private java.sql.Timestamp contrPeriod;
	
	private java.lang.String contrPeriodString;
	/**企业法人*/
	private java.lang.String corporate;
	/**注册地址*/
	private java.lang.String regAddress;
	/**办公地址*/
	private java.lang.String offAddress;
	/**联系人*/
	private java.lang.String contact;
	/**联系电话*/
	private java.lang.String mobileNo;
	/**状态:1-初始化，2-开通，4-暂停，5-停止*/
	private java.lang.String modeValue;
	/**公司电话*/
	private java.lang.String phoneValue;
	/**审核时间*/
	private java.sql.Timestamp auditTime;
	private java.lang.String auditTimeString;
	/**开通时间*/
	private java.sql.Timestamp openTime;
	private java.lang.String openTimeString;
	/**开通人*/
	private java.lang.String openPeople;
	/**机构信息是否同步:10-已经同步,20-未同步,将ADC机构代码写到cp_code_中,实现两边机构代码一致.*/
	/**bzq2011-04-16add*/
	private java.lang.String syncCpCode;
	private java.util.ArrayList idList;
	
	/**bzq add*/
	private User user;
	private UserRole userRole;
	
	
	//columns END
	
	public UserRole getUserRole() {
		return userRole;
	}

	public void setUserRole(UserRole userRole) {
		this.userRole = userRole;
	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}
 	
	 
 
 
	public DataOrganizations(){
		
	}

	public DataOrganizations(
		java.lang.String id
	){
		this.id = id;
	}

	public void setId(java.lang.String value) {
		this.id = value;
	}
	
	public java.lang.String getId() {
		return this.id;
	}
	public void setHigherId(java.lang.String value) {
		this.higherId = value;
	}
	
	public java.lang.String getHigherId() {
		return this.higherId;
	}
	public void setCpCode(java.lang.String value) {
		this.cpCode = value;
	}
	
	public java.lang.String getCpCode() {
		return this.cpCode;
	}
	public void setCpName(java.lang.String value) {
		this.cpName = value;
	}
	
	public java.lang.String getCpName() {
		return this.cpName;
	}
	public void setAbbreviation(java.lang.String value) {
		this.abbreviation = value;
	}
	
	public java.lang.String getAbbreviation() {
		return this.abbreviation;
	}
	public void setAboutInfo(java.lang.String value) {
		this.aboutInfo = value;
	}
	
	public java.lang.String getAboutInfo() {
		return this.aboutInfo;
	}
	public void setAreaId(java.lang.String value) {
		this.areaId = value;
	}
	
	public java.lang.String getAreaId() {
		return this.areaId;
	}
	public void setCpNature(java.lang.String value) {
		this.cpNature = value;
	}
	
	public java.lang.String getCpNature() {
		return this.cpNature;
	}
	public void setCoopType(java.lang.String value) {
		this.coopType = value;
	}
	
	public java.lang.String getCoopType() {
		return this.coopType;
	}
	public String getBeginTimeString() {
		return date2String(getBeginTime(), FORMAT_BEGIN_TIME_);
	}
	public void setBeginTimeString(String value) {
		setBeginTime(string2Date(value, FORMAT_BEGIN_TIME_,java.sql.Timestamp.class));
	}
	
	public void setBeginTime(java.sql.Timestamp value) {
		this.beginTime = value;
	}
	
	public java.sql.Timestamp getBeginTime() {
		return this.beginTime;
	}
	public void setContrNo(java.lang.String value) {
		this.contrNo = value;
	}
	
	public java.lang.String getContrNo() {
		return this.contrNo;
	}
	public String getContrPeriodString() {
		return date2String(getContrPeriod(), FORMAT_CONTR_PERIOD_);
	}
	public void setContrPeriodString(String value) {
		setContrPeriod(string2Date(value, FORMAT_CONTR_PERIOD_,java.sql.Timestamp.class));
	}
	
	public void setContrPeriod(java.sql.Timestamp value) {
		this.contrPeriod = value;
	}
	
	public java.sql.Timestamp getContrPeriod() {
		return this.contrPeriod;
	}
	public void setCorporate(java.lang.String value) {
		this.corporate = value;
	}
	
	public java.lang.String getCorporate() {
		return this.corporate;
	}
	public void setRegAddress(java.lang.String value) {
		this.regAddress = value;
	}
	
	public java.lang.String getRegAddress() {
		return this.regAddress;
	}
	public void setOffAddress(java.lang.String value) {
		this.offAddress = value;
	}
	
	public java.lang.String getOffAddress() {
		return this.offAddress;
	}
	public void setContact(java.lang.String value) {
		this.contact = value;
	}
	
	public java.lang.String getContact() {
		return this.contact;
	}
	public void setMobileNo(java.lang.String value) {
		this.mobileNo = value;
	}
	
	public java.lang.String getMobileNo() {
		return this.mobileNo;
	}
	public void setModeValue(java.lang.String value) {
		this.modeValue = value;
	}
	
	public java.lang.String getModeValue() {
		return this.modeValue;
	}
	public void setPhoneValue(java.lang.String value) {
		this.phoneValue = value;
	}
	
	public java.lang.String getPhoneValue() {
		return this.phoneValue;
	}
	public String getAuditTimeString() {
		return date2String(getAuditTime(), FORMAT_AUDIT_TIME_);
	}
	public void setAuditTimeString(String value) {
		setAuditTime(string2Date(value, FORMAT_AUDIT_TIME_,java.sql.Timestamp.class));
	}
	
	public void setAuditTime(java.sql.Timestamp value) {
		this.auditTime = value;
	}
	
	public java.sql.Timestamp getAuditTime() {
		return this.auditTime;
	}
	public String getOpenTimeString() {
		return date2String(getOpenTime(), FORMAT_OPEN_TIME_);
	}
	public void setOpenTimeString(String value) {
		setOpenTime(string2Date(value, FORMAT_OPEN_TIME_,java.sql.Timestamp.class));
	}
	
	public void setOpenTime(java.sql.Timestamp value) {
		this.openTime = value;
	}
	
	public java.sql.Timestamp getOpenTime() {
		return this.openTime;
	}
	public void setOpenPeople(java.lang.String value) {
		this.openPeople = value;
	}
	
	public java.lang.String getOpenPeople() {
		return this.openPeople;
	}

    public java.util.ArrayList getIdList() {
	    return idList;
    }

    public void setIdList(java.util.ArrayList idList) {
    	this.idList = idList;
    }
	public java.lang.String getAreaName() {
		return areaName;
	}

	public void setAreaName(java.lang.String areaName) {
		this.areaName = areaName;
	}

	public java.lang.String getSyncCpCode() {
		return syncCpCode;
	}

	public void setSyncCpCode(java.lang.String syncCpCode) {
		this.syncCpCode = syncCpCode;
	}
	
    /**手动增加属性后,toString,hashCode,equals都要修改*/
	public String toString() {
		return new ToStringBuilder(this)
			.append("Id",getId())
			.append("HigherId",getHigherId())
			.append("CpCode",getCpCode())
			.append("CpName",getCpName())
			.append("Abbreviation",getAbbreviation())
			.append("AboutInfo",getAboutInfo())
			.append("AreaId",getAreaId())
			.append("CpNature",getCpNature())
			.append("CoopType",getCoopType())
			.append("BeginTime",getBeginTime())
			.append("ContrNo",getContrNo())
			.append("ContrPeriod",getContrPeriod())
			.append("Corporate",getCorporate())
			.append("RegAddress",getRegAddress())
			.append("OffAddress",getOffAddress())
			.append("Contact",getContact())
			.append("MobileNo",getMobileNo())
			.append("ModeValue",getModeValue())
			.append("PhoneValue",getPhoneValue())
			.append("AuditTime",getAuditTime())
			.append("OpenTime",getOpenTime())
			.append("OpenPeople",getOpenPeople())
			.append("SyncCpCode",getSyncCpCode())
			
			.toString();
	}
	
	public int hashCode() {
		return new HashCodeBuilder()
			.append(getId())
			.append(getHigherId())
			.append(getCpCode())
			.append(getCpName())
			.append(getAbbreviation())
			.append(getAboutInfo())
			.append(getAreaId())
			.append(getCpNature())
			.append(getCoopType())
			.append(getBeginTime())
			.append(getContrNo())
			.append(getContrPeriod())
			.append(getCorporate())
			.append(getRegAddress())
			.append(getOffAddress())
			.append(getContact())
			.append(getMobileNo())
			.append(getModeValue())
			.append(getPhoneValue())
			.append(getAuditTime())
			.append(getOpenTime())
			.append(getOpenPeople())
			.append(getSyncCpCode())
			
			.toHashCode();
	}
	
	public boolean equals(Object obj) {
		if(obj instanceof DataOrganizations == false) return false;
		if(this == obj) return true;
		DataOrganizations other = (DataOrganizations)obj;
		return new EqualsBuilder()
			.append(getId(),other.getId())
			.append(getHigherId(),other.getHigherId())
			.append(getCpCode(),other.getCpCode())
			.append(getCpName(),other.getCpName())
			.append(getAbbreviation(),other.getAbbreviation())
			.append(getAboutInfo(),other.getAboutInfo())
			.append(getAreaId(),other.getAreaId())
			.append(getCpNature(),other.getCpNature())
			.append(getCoopType(),other.getCoopType())
			.append(getBeginTime(),other.getBeginTime())
			.append(getContrNo(),other.getContrNo())
			.append(getContrPeriod(),other.getContrPeriod())
			.append(getCorporate(),other.getCorporate())
			.append(getRegAddress(),other.getRegAddress())
			.append(getOffAddress(),other.getOffAddress())
			.append(getContact(),other.getContact())
			.append(getMobileNo(),other.getMobileNo())
			.append(getModeValue(),other.getModeValue())
			.append(getPhoneValue(),other.getPhoneValue())
			.append(getAuditTime(),other.getAuditTime())
			.append(getOpenTime(),other.getOpenTime())
			.append(getOpenPeople(),other.getOpenPeople())
			.append(getSyncCpCode(),other.getSyncCpCode())
			
			.isEquals();
	}


}

